package com.jeff.tianti.cms.entity;

import com.jeff.tianti.common.entity.BaseEntity;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Entity
@Table(name = "awards_to_declare")//奖项申报表
public class AwardsToDeclare extends BaseEntity {
    private static final long serialVersionUID = 3035275726591496051L;
    @Column(name = "uid")
    private String uid;//用户id
     @Column(name = "company_name")
    private String companyName;//单位名称
    @Column(name = "linkman")
    private String linkman;//联系人
    @Column(name = "state")
    private String state;//0->服务品牌紫金奖 1->优秀广告作品奖
     @Column(name = "phone")
    private String phone;//联系人电话
     @Column(name = "design_desc")
    private String designDesc;//设计说明
     @Column(name = "url")
    private String url;//图片路径字符串
    private List<String> urls;

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getLinkman() {
        return linkman;
    }

    public void setLinkman(String linkman) {
        this.linkman = linkman;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getDesignDesc() {
        return designDesc;
    }

    public void setDesignDesc(String designDesc) {
        this.designDesc = designDesc;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Transient
    public List<String> getUrls() {
        List<String> list = new ArrayList<>();
        if (StringUtils.isNotBlank(url)) {
            list = Arrays.asList(url.split(","));
        }
        return list;
    }

    public void setUrls(List<String> urls) {
        this.urls = urls;
    }
}
